Crate magma[−][src]
Implementation of the block cipher defined in GOST 28147-89 and GOST R 34.12-2015.
Examples
use magma::{Magma, BlockCipher, BlockEncrypt, BlockDecrypt, NewBlockCipher}; use magma::cipher::generic_array::GenericArray; use hex_literal::hex; // Example vector from GOST 34.12-2018 let key = hex!(" FFEEDDCCBBAA99887766554433221100 F0F1F2F3F4F5F6F7F8F9FAFBFCFDFEFF "); let plaintext = hex!("FEDCBA9876543210"); let ciphertext = hex!("4EE901E5C2D8CA3D"); let cipher = Magma::new(GenericArray::from_slice(&key)); let mut block = GenericArray::clone_from_slice(&plaintext); cipher.encrypt_block(&mut block); assert_eq!(&ciphertext, block.as_slice()); cipher.decrypt_block(&mut block); assert_eq!(&plaintext, block.as_slice());
Re-exports
pub use cipher; |
Structs
Gost89 | Block cipher defined in GOST 28147-89 generic over S-box |
Traits
BlockCipher | Trait which marks a type as being a block cipher. |
BlockDecrypt | Decrypt-only functionality for block ciphers. |
BlockEncrypt | Encrypt-only functionality for block ciphers. |
NewBlockCipher | Instantiate a |
Sbox | Trait implemented for the GOST 28147-89 cipher S-boxes |
Type Definitions
Gost89CryptoProA | Block cipher defined in GOST 28147-89 with CryptoPro S-box version A |
Gost89CryptoProB | Block cipher defined in GOST 28147-89 with CryptoPro S-box version B |
Gost89CryptoProC | Block cipher defined in GOST 28147-89 with CryptoPro S-box version C |
Gost89CryptoProD | Block cipher defined in GOST 28147-89 with CryptoPro S-box version D |
Gost89Test | Block cipher defined in GOST 28147-89 with test S-box |
Magma | Block cipher defined in GOST R 34.12-2015 (Magma) |